package cn.edu.cqut.mdm.web.bean;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

import cn.edu.cqut.mdm.core.module.ModuleEntity;
import cn.edu.cqut.mdm.core.module.PublishStatus;

public class ModuleEntityBean {
	private String uid;
	private String name;
	private Class<?> moduleClazz;
	private List<Method> methods;
	private List<PublishStatus> publishStatuses = new ArrayList<PublishStatus>();
	
	public ModuleEntityBean(String uid, String name, Class<?> clazz, List<Method> methods) {
		this.uid = uid;
		this.name = name;
		this.moduleClazz = clazz;
		this.methods = methods;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Class<?> getModuleClazz() {
		return moduleClazz;
	}

	public void setModuleClazz(Class<?> clazz) {
		this.moduleClazz = clazz;
	}

	public List<Method> getMethods() {
		return methods;
	}

	public void setMethods(List<Method> methods) {
		this.methods = methods;
	}

	public List<PublishStatus> getPublishStatuses() {
		return publishStatuses;
	}

	public void addPublishStatus(PublishStatus publishStatus) {
		this.publishStatuses.add(publishStatus);
	}
	
	public static ModuleEntityBean fromModuleEntity(ModuleEntity moduleEntity) {
		return new ModuleEntityBean(moduleEntity.getUid(), moduleEntity.getName(), moduleEntity.getModuleClazz(), moduleEntity.getMethods());
	}
}
